package org.ushio.speech_module.speech.chapter;

import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serial;
import java.io.Serializable;

/**
 * @author 陈红
 * 章节实体类
 */
@Getter
@Setter
public class Chapter implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    private Long chapterId;
    private Long bookId;

    @NotNull(message = "章节标题不能为空")
    @Size(max = 100, message = "章节标题不能超过100个字符")
    private String etitle;

    @NotNull(message = "章节英文标题不能为空")
    @Size(max = 100, message = "章节英文标题不能超过100个字符")
    @Pattern(regexp = "^[A-Za-z0-9\\s]+$", message = "章节英文标题只能包含字母、数字和空格")
    private String title;

    @Override
    public String toString() {
        return "Chapter{" +
                "chapterId=" + chapterId +
                ", bookId=" + bookId +
                ", etitle='" + etitle + '\'' +
                ", title='" + title + '\'' +
                '}';
    }
}
